package com.rchat.pocmini.activity.groupmember;

import com.airtalkee.sdk.AirtalkeeAccount;
import com.aso.common.http.delegate.HttpCallbackImpl;
import com.aso.common.http.utils.HttpUtils;
import com.rchat.pocmini.global.HttpCodeGlobal;
import com.rchat.pocmini.global.RequestParam;
import com.rchat.pocmini.global.UrlsGlobal;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by ljd on 2017/9/7.
 */

public class GroupMemberModelImpl implements GroupMemberContract.Model {
    @Override
    public void queryGroupMember(String groupId, HttpCallbackImpl callback) {
        Map<String, String> param = new HashMap<>();
        param.put("groupId", groupId);
        //body = {"code":1221,"data":{"platform":1,"version":"1.0","enterprise":1,"groupId":"C20795"}}
        String body = RequestParam.requestRootParam(HttpCodeGlobal.REQ_CODE_1221, param);
        HttpUtils.postAsyn(UrlsGlobal.getUrl(UrlsGlobal.QUERY_GROUP_MEMBER), body, callback);
    }

    @Override
    public void delGroup(String groupId, String user, HttpCallbackImpl callback) {

        Map<String, String> param = new HashMap<>();
        param.put("userName", user);
        param.put("groupId", groupId);
        //body = {"code":1027,"data":{"platform":1,"version":"1.0","enterprise":1,"groupId":"C20796","userName":"111110000118"}}
        String body = RequestParam.requestRootParam(HttpCodeGlobal.REQ_CODE_1027, param);
        HttpUtils.postAsyn(UrlsGlobal.getUrl(UrlsGlobal.DEL_GRPOUP), body, callback);
    }
}
